Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman load/save: support multi-image docker archive #6811

Merged

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Jun 29, 2020

Fixes: #2669
Signed-off-by: Valentin Rothberg rothberg@redhat.com

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 29, 2020
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2020
@vrothberg
Copy link
Member Author

Need to get containers/image#975 in before.

@vrothberg vrothberg force-pushed the multi-image-archives branch 3 times, most recently from cda54b9 to 9efd4e8 Compare July 2, 2020 14:07
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 13, 2020
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few notes while primarily reading the called c/image implementation.

pkg/domain/entities/images.go Outdated Show resolved Hide resolved
libpod/image/pull.go Outdated Show resolved Hide resolved
libpod/image/pull.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2020
@vrothberg vrothberg force-pushed the multi-image-archives branch 2 times, most recently from aef021b to e745b41 Compare July 31, 2020 12:01
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to libpod/image/pull.go were dropped — is that intentional?

In a sense they really don’t belong into this PR, OTOH fixing the existing fairly broken podman pull docker-archive:… code would be nice.

@vrothberg
Copy link
Member Author

The changes to libpod/image/pull.go were dropped — is that intentional?

In a sense they really don’t belong into this PR, OTOH fixing the existing fairly broken podman pull docker-archive:… code would be nice.

That was intentional as I want us to focus on the multi-image part first. Once that's in, we can tackle the next issue - unless you feel strongly to tackle both at once.

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 3, 2020

I’m fine with having the PR narrowly scoped; what is/isn’t necessary to keep the Podman repo maintainable is up to the judgment of Podman maintainers.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2020
@vrothberg vrothberg force-pushed the multi-image-archives branch 3 times, most recently from 40a2408 to 0a03352 Compare August 11, 2020 12:07
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More skeletons in the closet…

libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
libpod/image/image.go Outdated Show resolved Hide resolved
pkg/domain/entities/images.go Show resolved Hide resolved
@vrothberg vrothberg force-pushed the multi-image-archives branch 3 times, most recently from 0041d39 to b1a155f Compare August 12, 2020 14:30
@vrothberg
Copy link
Member Author

Back to c/storage v1.23.0

@vrothberg
Copy link
Member Author

@edsantiago are https://github.com/containers/podman/pull/6811/checks?check_run_id=1007722626 flakes?

@mtrmac, I am running out of time. If you find some cycles, feel free to take over this PR and push it over the finish line.

@edsantiago
Copy link
Member

@vrothberg those show every sign of being #7195 but I've never seen so many in one run.

@vrothberg
Copy link
Member Author

Restarted the last flaky job. The flakes are hitting this PR hard.

@rhatdan
Copy link
Member

rhatdan commented Aug 21, 2020

Your getting hit by the flake I can not get by.

@vrothberg
Copy link
Member Author

It's green, it's green!

@rhatdan, let's merge before the CI gods stop shining upon me head.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK (full review now), just some maintainability suggestions.

libpod/image/pull.go Show resolved Hide resolved
libpod/image/pull.go Outdated Show resolved Hide resolved
libpod/image/pull.go Outdated Show resolved Hide resolved
libpod/image/pull_test.go Outdated Show resolved Hide resolved
libpod/image/pull_test.go Outdated Show resolved Hide resolved
libpod/image/pull_test.go Outdated Show resolved Hide resolved
@mtrmac
Copy link
Collaborator

mtrmac commented Sep 7, 2020

Also, this vendors an unreleased version of c/image. Is that OK?

@mheon
Copy link
Member

mheon commented Sep 7, 2020

OK for now, but we'll need to get a c/image release out in the next several weeks for Podman 2.1.0 so we don't cut a full release with a prerelease c/image

Support loading and saving tarballs with more than one image.
Add a new `/libpod/images/export` endpoint to the rest API to
allow for exporting/saving multiple images into an archive.

Note that a non-release version of containers/image is vendored.
A release version must be vendored before cutting a new Podman
release.  We force the containers/image version via a replace in
the go.mod file; this way go won't try to match the versions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
@vrothberg
Copy link
Member Author

Final polish based on @mtrmac's comments pushed.

k8s.io/api v0.0.0-20190620084959-7cf5895f2711
k8s.io/apimachinery v0.19.0
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
)

replace github.com/containers/image/v5 => github.com/containers/image/v5 v5.5.2-0.20200902171422-1c313b2d23e0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a WIP until this is released? I think we should release containers/image so that @mheon can release pdoman 2.1.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mheon acked above (see #6811 (comment)). We just need to release before v2.1.0 which is still a bit in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhatdan We're still waiting on a few more PRs in Podman land (I don't want to cut a 2.1.0 without #7452 because that's blocking some folks from moving off 1.9) so we have a bit of time.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@rhatdan
Copy link
Member

rhatdan commented Sep 9, 2020

/lgtm
But this Podman can not be released until containers/image is updated.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 9, 2020
@openshift-merge-robot openshift-merge-robot merged commit 6b1a1fc into containers:master Sep 9, 2020
@maybe-sybr
Copy link
Contributor

Is there any follow up work planned to bring the other formats into line with this? In particular I'm interested in oci-dir.

@vrothberg vrothberg deleted the multi-image-archives branch October 15, 2020 07:19
@vrothberg
Copy link
Member Author

Is there any follow up work planned to bring the other formats into line with this? In particular I'm interested in oci-dir.

The oci transports already supports multiple image for storing images. However, there's no easy way to use it as a source without knowing the exact images in the directory: Error initializing source oci:/home/vrothberg/foo:: more than one image in oci, choose an image

@nalind @mtrmac I haven't checked the code but assume that the oci transport may need some wiring w.r.t. to image indexes to make it work?

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 15, 2020

A similar list/get-reference API seems natural; the thing I’m not currently sure about is multi-arch support; that somehow uses OCI indices, and I’m not quite sure how. IIRC it’s not a nested-index design, so the top-level index might be a multi-arch image set, not a multi-image archive. @nalind probably knows more.

@nalind
Copy link
Member

nalind commented Oct 19, 2020

When we merged manifest list support, the oci transports stopped assuming that a manifest being added to them wasn't a list, so entries they contain can now themselves be either lists, or images that would be included in a list, and tag ("org.opencontainers.image.ref.name") annotations stored in the top-level index can be attached to either. They no longer attempt to auto-generate Platform information for their contents, either.

Copying using skopeo copy --all from a source that is a manifest list to an oci location produces this:

- index.json (1 entry which may have an "org.opencontainers.image.ref.name" annotation)
- blobs/
  - sha256/
    - manifest list as a blob (only entry in index.json)
    - manifests referred to by the manifest list, as blobs
    - blobs referred to by those manifests

Copying from another location into the same oci location adds another entry to the top-level index.json, and either the single manifest or the manifest list and some number of the manifests it refers to, along with other blobs, to the blobs/sha256 subdirectory, so you get either:

- index.json (2 entries which may have "org.opencontainers.image.ref.name" annotations)
- blobs/
  - sha256/
    - two manifest lists as blobs (first and second entries in index.json)
    - manifests referred to by either manifest list, as blobs
    - blobs referred to by those manifests

or

- index.json (2 entries which may have "org.opencontainers.image.ref.name" annotations)
- blobs/
  - sha256/
    - a manifest list as a blob (first entry in index.json)
    - manifests referred to by the manifest list, as blobs
    - a manifest as a blob (second entry in index.json)
    - blobs referred to by those manifests

When using an oci location as a source, if there's exactly one item (whether it's a list or not is irrelevant at this point) listed in the oci location's index.json, not specifying a tag when referring to the layout as a source will return that one item as a starting point, and if that's a manifest list, the library's copying logic either copies everything in the list or some subset, just as it would if it were reading from a registry and starting with the same item.

If there's more than one item in the oci location, then they really need to have "org.opencontainers.image.ref.name" annotations on them, because otherwise we don't know how to specify which of them to start copying from, list or not, since references for those transports currently don't have a form that incorporates digests, and we don't have a way to list their contents.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman save not saving multiple images